<style>
    .sale_mode{
        position: absolute;
        top: 30px;
        background-color: #ffffff;
        z-index: 9;
        border: 1px solid rgba(210,210,210,0.8);
        line-height: initial;
        border-radius: 3px;
        box-shadow: 0 0 2px rgba(210,210,210,0.8);
        display: none;
    }
    .sale_mode li{
        list-style: none;
        padding: 5px 10px;
        cursor: pointer;
        color: initial;
    }
    .sale_mode li:hover, .sale_mode li.on{
        background-color: #FE2E54 !important;
        color: #ffffff;
    }
</style>
<div class="layui-container">
    <div class="layui-card mt20">
        <div class="tag-wrap layui-card-header">
            <div class="head-item">
                <a href="javascript:void(0);" id="zoom_sort">综合</a>
            </div>
            <div class="head-item">
                <a href="javascript:void(0);" id="sale">
                    销量
                </a>
                <ul class="sale_mode">
                    <li mode="des">从高到低</li>
                    <li mode="asc">从低到高</li>
                </ul>
            </div>
            <!--<div class="head-item">
                <a href="">最新</a>
            </div>-->
            <div class="sort-price-area">
                <input class="min-price" name="jgqj1" value="" placeholder="￥">
                <span>-</span>
                <input class="max-price" name="jgqj2" value="" placeholder="￥">
                <button class="theme-bg-color-1 theme-hover-bg-color-3" id="sortSeachSubmit">确认</button>
                <a class="clear-price" href="javascript:void(0);">清除</a>
            </div>
            <!--<div class="goods-pages-page clearfix" style="">
                <span class="pagebtn disabled pre-page"></span>
                <span class="page-num"><b>1</b>/3</span>
                <span class="pagebtn next-page"><a
                        href="/index.php?r=l&amp;kw=%E8%93%9D%E7%89%99%E8%80%B3%E6%9C%BA&amp;s=t&amp;hot=1&amp;u=1174695&amp;page=2"></a></span>
            </div>-->
        </div>
        <div class="layui-card-body">
            <div class="cat-list sale-type clearfix">
                <div class="layui-form" lay-filter="s1">
                    <!--<span class="item">
                        <input type="checkbox" name="" title="淘抢购" lay-skin="primary">
                    </span>
                    <span class="item">
                        <input type="checkbox" name="" title="聚划算" lay-skin="primary">
                    </span>
                    <span class="item">
                        <input type="checkbox" name="" title="精选品牌" lay-skin="primary">
                    </span>
                    <span class="item">
                        <input type="checkbox" name="" title="金牌卖家" lay-skin="primary">
                    </span>-->
                    <span class="item">
                        <input type="checkbox" name="" title="海外淘" lay-filter="overseas" lay-skin="primary">
                    </span>
                    <span class="item">
                        <input type="checkbox" name="tmall" title="天猫" lay-filter="tmall" lay-skin="primary">
                    </span>
                </div>
            </div>
            <div class="goods-list">
                {include file="index/good_list" /}
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var form = layui.form;
        var query = {$query};
        delete query.page;
        form.on('checkbox(tmall)', function(data){
            if(data.elem.checked) {
                query.tmall = 'true';
            }else {
                delete query.tmall;
            }
            req()
        });
        form.on('checkbox(overseas)', function(data){
            if(data.elem.checked) {
                query.overseas = 'true';
            }else {
                delete query.overseas;
            }
            req()
        });
        $('#sortSeachSubmit').on('click',function () {
            query.min_price = $('.min-price').val();
            query.max_price = $('.max-price').val();
            req();
        });
        $('.clear-price').on('click', function () {
            $('.min-price').val('');
            $('.max-price').val('');
            delete query.min_price;
            delete query.max_price;
        });
        $('#sale').on('click', function () {
            if($('.sale_mode').is(':hidden')) {
                $('.sale_mode').css('display', 'inline-block');
            }else{
                $('.sale_mode').css('display', 'none');
            }
        });
        $('.sale_mode li').on('click', function () {
            var mode = $(this).attr('mode');
            query.sort = 'total_sales_'+mode;
            $(this).siblings().removeClass('on');
            $(this).removeClass('on').addClass('on');
            $(this).parent().css('display', 'none');
            req();
        });
        $('#zoom_sort').click(function () {
            $('.sale_mode li').removeClass('on');
            delete query.sort;
            req();
        });
        function req() {
            var url = '{:request()->baseUrl()}';
            var opt = {
                url:url,
                data:query,
                container:'.goods-list',
                type:'get'
            }
            ICY8._pjax(opt);
        }
    })
</script>